package com.hnx.admin.aurora.controller;

import com.hnx.admin.aurora.domain.query.GenTableQuery;
import com.hnx.admin.aurora.service.GenTableService;
import com.hnx.admin.aurora.web.json.ResultJson;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
创建人： 倔强的头发
创建时间：2025/6/24
功能描述:

*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/tool/gen")
public class GenController {
    private final GenTableService genTableService;
    /**
     * 查询代码生成列表
     */
    @PreAuthorize("@auth.hasPermi('tool:gen:list')")
    @GetMapping("/list")
    public ResultJson genList(GenTableQuery genTable)
    {
        return genTableService.selectGenTableList(genTable);
    }
    /**
     * 预览代码
     */
    @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
    @GetMapping("/preview/{tableId}")
    public ResultJson preview(@PathVariable("tableId") Long tableId)
    {
        return genTableService.previewCode(tableId);
    }
}
